---
title: Sui Client CLI
description: The Sui Client CLI provides command-level access to interact with the Sui network.
keywords: [ sui cli, sui client cli, sui client cli, sui client, sui cli help, sui cli reference, sui cli commands, cli commands, cli reference ]
---

The Sui CLI `client` command provides command-level access to interact with the Sui network. Typical uses for `sui client` include publishing Move smart contracts, getting the information of an object, executing transactions, or managing addresses.

<ImportContent source="cli-check-install.mdx" mode="snippet" />

## Commands

```sh
$ sui client --help
```

<ImportContent source="console-output/sui-client-help.mdx" mode="snippet" />

## JSON output

Append the `--json` flag to commands to format responses in JSON instead of the more human-friendly default Sui CLI output. This can be useful for extremely large datasets, for example, as those results can have a troublesome display on smaller screens. In these cases, the `--json` flag is useful.

## Examples

The following examples demonstrate some of the most often used commands.

### List available network environments

Use the `sui client envs` command to find the network environments set up in the CLI. The information for these environments is also stored in the client.yaml file in the Sui configuration directory (`~/.sui/sui_config`).

```sh
╭────────┬────────────────────────────────────┬────────╮
│ alias  │ url                                │ active │
├────────┼────────────────────────────────────┼────────┤
│ devnet │ https://fullnode.devnet.sui.io:443 │ *  	   │
╰────────┴────────────────────────────────────┴────────╯
```

### Create network environment

Use `client new-env` to add details for a new network environment. This example creates an environment pointer to Sui Mainnet. Setting the `alias` value makes referencing the environment less prone to typographical errors. After running this command, Sui updates your client.yaml file in `~/.sui/sui_config` with the new information.

```
$ sui client new-env --alias=mainnet --rpc https://fullnode.mainnet.sui.io:443

Added new Sui env [mainnet] to config.
```

### Set current environment

Use the `sui client switch` command to change the current network. This example switches the current network to `mainnet`.

```sh
$ sui client switch --env mainnet
```
```sh
Active environment switched to [mainnet]
```

If you run `sui client envs` after this command, you see the asterisk in the `active` column on the `mainnet` row of the table.

### Get current active address

Use the `sui client active-address` command to reveal the current address. The CLI uses the current active address to execute address-specific CLI commands (like `sui client objects`) when you don't provide them with a Sui address value.

```sh
$ sui client active-address
```
```sh
0x514692f08249c3e9951234ce29074695840422564bff85e424b56de462913e0d
```

### Request a SUI coin from faucet

If you use one of the standard public RPCs (for example, `fullnode.devnet.sui.io:443`), you can use the `faucet` command to request gas coins. If you use a custom faucet service, then pass in the URL to the faucet using the `--url` option.
The `faucet` command works for a local network, as well. If you start your network with a custom faucet port, include the `--url` option.

```sh
$ sui client faucet
```
```sh
Request successful. It can take up to 1 minute to get the coin. Run sui client gas to check your gas coins.
```

### Get objects owned by an address

Use `sui client objects` to list summary information about the objects the current active address owns. You can provide a Sui address value to the command to list objects for a particular address. This example lists objects for the current active address.

```sh
$ sui client objects 0x36df11369cf00ecf0be68d6ba965b0abe2e883bc5245911e3a29ebfa0aaf6b69
```
```sh
╭───────────────────────────────────────────────────────────────────────────────────────╮
| ╭────────────┬──────────────────────────────────────────────────────────────────────╮ │
│ │ objectId   │  0xfffbb30ccb631f15f6cd36700589fc9c31cb04af28a95f3ed26d62daf3acb57f  │ │
│ │ version	   │  33363559                                                        	  │ │
│ │ digest 	   │  IY7/qsIJhliQL0uxwSzNYu0SMcn5AMsqQklSGngn1V0=                    	  │ │
│ │ objectType │  0x0000..0002::coin::Coin                                        	  │ │
│ ╰────────────┴──────────────────────────────────────────────────────────────────────╯ │
│ ╭────────────┬──────────────────────────────────────────────────────────────────────╮ │
│ │ objectId   │  0xfffe59fb6f78b1ced7f6537e69a205cc45d105270857bfd66332f9a627a38ae0  │ │
│ │ version	   │  33370864                                                            │ │
│ │ digest     │  b+tKChvujbCk/UCm8L+lflyb6Vjt7beB+uz6+ahUHmM=                    	  │ │
│ │ objectType │  0x0000..0002::coin::Coin                                        	  │ │
│ ╰────────────┴──────────────────────────────────────────────────────────────────────╯ │
╰───────────────────────────────────────────────────────────────────────────────────────╯
```

### Get complete object information

Use `sui client object <OBJECT-ID>` to list object information for the ID you provide. This example displays the information for a Coin object.

```sh
$ sui client object 0xfffbb30ccb631f15f6cd36700589fc9c31cb04af28a95f3ed26d62daf3acb57f
```
```sh
╭───────────────┬─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ objectId  	  │  0xfffbb30ccb631f15f6cd36700589fc9c31cb04af28a95f3ed26d62daf3acb57f                                             	  │
│ version   	  │  33363559                                                                                                       	  │
│ digest    	  │  3FzvXJVVVcXb9H6dEXdARaY9EmxXyyNFduet3X4eYV4x                                                                   	  │
│ objType   	  │  0x2::coin::Coin<0x2::sui::SUI>                                                                                 	  │
│ ownerType 	  │  AddressOwner                                                                                                   	  │
│ prevTx    	  │  ES2RQThjRE5u8rwiUEnhcnMoLA3cHeEGYJ8Pq98tmyAc                                                                   	  │
│ storageRebate │  988000                                                                                                         	  │
│ content   	  │ ╭───────────────────┬─────────────────────────────────────────────────────────────────────────────────────────────╮ │
│           	  │ │ dataType      	  │  moveObject                                                                            	    │ │
│           	  │ │ type          	  │  0x2::coin::Coin<0x2::sui::SUI>                                                       	    │ │
│           	  │ │ hasPublicTransfer │  true                                                                                    	  │ │
│           	  │ │ fields        	  │ ╭─────────┬───────────────────────────────────────────────────────────────────────────────╮ │ │
│           	  │ │               	  │ │ balance │  530076676                                                                	  │ │ │
│           	  │ │               	  │ │ id  	  │ ╭────┬──────────────────────────────────────────────────────────────────────╮ │ │ │
│           	  │ │               	  │ │     	  │ │ id │  0xfffbb30ccb631f15f6cd36700589fc9c31cb04af28a95f3ed26d62daf3acb57f  │ │ │ │
│           	  │ │               	  │ │     	  │ ╰────┴──────────────────────────────────────────────────────────────────────╯ │ │ │
│           	  │ │               	  │ ╰─────────┴───────────────────────────────────────────────────────────────────────────────╯ │ │
│           	  │ ╰───────────────────┴─────────────────────────────────────────────────────────────────────────────────────────────╯ │
╰───────────────┴─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
```

### Get dynamic fields of an object

Use the `sui client dynamic-field <DYNAMIC-FIELD-ID>` command to list the details of the dynamic field with the ID you provide.

```sh
$ sui client dynamic-field 0x5
```
```sh
╭─────────────┬───────────────────────────────────────────────────────────────────────────────────────────╮
│ hasNextPage │  false                                                                                	  │
│ nextCursor  │  0x5b890eaf2abcfa2ab90b77b8e6f3d5d8609586c3e583baf3dccd5af17edf48d1                   	  │
│ data     	  │ ╭───────────────────────────────────────────────────────────────────────────────────────╮ │
│         	  │ │ ╭────────────┬──────────────────────────────────────────────────────────────────────╮ │ │
│         	  │ │ │ name   	   │ ╭───────┬───────╮                                                	  │ │ │
│         	  │ │ │        	   │ │ type  │  u64  │                                                	  │ │ │
│         	  │ │ │        	   │ │ value │  2	 │                                                	    │ │ │
│         	  │ │ │        	   │ ╰───────┴───────╯                                                	  │ │ │
│         	  │ │ │ bcsName	   │  LQM2cdzDY3                                                      	  │ │ │
│         	  │ │ │ type   	   │  DynamicField                                                    	  │ │ │
│         	  │ │ │ objectType │  0x3::sui_system_state_inner::SuiSystemStateInnerV2              	  │ │ │
│         	  │ │ │ objectId   │  0x5b890eaf2abcfa2ab90b77b8e6f3d5d8609586c3e583baf3dccd5af17edf48d1  │ │ │
│         	  │ │ │ version	   │  112                                                             	  │ │ │
│         	  │ │ │ digest 	   │  HMrm1KNKjq3GfB1cWTRdvRo8gk7auhgvoZXaVoyEHqUR                    	  │ │ │
│         	  │ │ ╰────────────┴──────────────────────────────────────────────────────────────────────╯ │ │
│         	  │ ╰───────────────────────────────────────────────────────────────────────────────────────╯ │
╰─────────────┴───────────────────────────────────────────────────────────────────────────────────────────╯
```

### Send SUI or objects

In this example, let's see how to transfer SUI or transfer an object from one address to another. First of all, there two main commands for sending SUI or transferring objects: `pay` and `transfer`.
Both `pay` and `transfer` have a few sister commands: `pay-sui`, `pay-all-sui`, `transfer-sui`.

The differences between these commands are:
- commands that end in `-sui` deal with Sui's native coin, and they use the input coints to pay for gas and for transferring SUI or the object.
- `pay-` commands typically deal with coins and handle gas smashing for you, whereas `transfer` commands can handle the transfer of any object that has public transfer, meaning any object that has the `store` ability.
- `pay` commands allow you to send coins to multiple recipients, whereas `transfer` commands only accept one recipient.
- `pay-all-sui` is a special case of `pay-sui` that offers a way to transfer the entire balance after smashing.
- `transfer-sui` is a legacy command and has been entirely superseded by `pay-sui` or `pay-all-sui` depending on whether an amount is specified or not.

Assume you have two addresses:

```sh
╭───────────────────┬────────────────────────────────────────────────────────────────────┬────────────────╮
│ alias             │ address                                                            │ active address │
├───────────────────┼────────────────────────────────────────────────────────────────────┼────────────────┤
│ hungry-spodumene  │ 0x0fe375fff0ee40d20c54a7f2478b9b5c7eaa3625b7611f9661ec5faefb4a6fea │ *              │
│ eloquent-amber    │ 0x3d78abc33ccd173c521b4f9e78b21ea2c989960b631732c539efaa38bda30976 │                │
╰───────────────────┴────────────────────────────────────────────────────────────────────┴────────────────╯
````

Address `hungry-spodumene` has a few coins:

```sh
$ sui client gas hungry-spodumene
```
```sh
╭────────────────────────────────────────────────────────────────────┬────────────────────┬──────────────────╮
│ gasCoinId                                                          │ mistBalance (MIST) │ suiBalance (SUI) │
├────────────────────────────────────────────────────────────────────┼────────────────────┼──────────────────┤
│ 0x205972830acd8264a38b9a1776a1b72a1ae626fa23a4d1f12249349ce3b83c06 │ 200000000000       │ 200.00           │
│ 0x56d76420a5bc7d356e3930e6a2ddc61cbbc0c87ea5c5f3cc3ac5952b4d52be5a │ 200000000000       │ 200.00           │
│ 0xc9b447fff18f13fa035e028534b8344d5fc8a8760248fad10155e78f44dc3a52 │ 200000000000       │ 200.00           │
│ 0xe373de9bdbd3dbd4f5f707f144c83af74a181cdb3903a953ee366f48e33865c7 │ 200000000000       │ 200.00           │
│ 0xf7adb6aeb18eb409c03fe88cc31711b61a65333e0fdd88c1815d4ec75f713f31 │ 200000000000       │ 200.00           │
╰────────────────────────────────────────────────────────────────────┴────────────────────┴──────────────────╯
```

You want to send 0.5 SUI to `eloquent-amber`. Given that you have a few gas coins, you can use `pay`. If only one gas coin exists, then you need to use `transfer-sui` or `pay-sui`, or you would need to split the coin first to have another coin to use for paying gas. In this case, let's use the `pay-sui` command as you do not need to provide a separate gas coin to be used for the gas fees. In the command below, you set the recipient to be `eloquent-amber`, which coin to use to transfer SUI from, and the amount of SUI to transfer.

<ImportContent source="info-gas-budget.mdx" mode="snippet" />

```sh
$ sui client pay-sui --recipients eloquent-amber --input-coins 0xc9b447fff18f13fa035e028534b8344d5fc8a8760248fad10155e78f44dc3a52 --amounts 500000000 --gas-budget 5000000
```

The result is:

```sh
Transaction Digest: AsWkciVhLHeCmqVipjjyAA7Hv5y87pFjHS59K8m4zBJV
╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ Transaction Data                                                                                             │
├──────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│ Sender: 0x0fe375fff0ee40d20c54a7f2478b9b5c7eaa3625b7611f9661ec5faefb4a6fea                                   │
│ Gas Owner: 0x0fe375fff0ee40d20c54a7f2478b9b5c7eaa3625b7611f9661ec5faefb4a6fea                                │
│ Gas Budget: 5000000 MIST                                                                                     │
│ Gas Price: 1000 MIST                                                                                         │
│ Gas Payment:                                                                                                 │
│  ┌──                                                                                                         │
│  │ ID: 0xc9b447fff18f13fa035e028534b8344d5fc8a8760248fad10155e78f44dc3a52                                    │
│  │ Version: 2                                                                                                │
│  │ Digest: 9MEH7kr1YkBDx7pdUPCDnVb3FtPz9UZVeWmCot5Dhxqr                                                      │
│  └──                                                                                                         │
│                                                                                                              │
│ Transaction Kind: Programmable                                                                               │
│ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │
│ │ Input Objects                                                                                            │ │
│ ├──────────────────────────────────────────────────────────────────────────────────────────────────────────┤ │
│ │ 0   Pure Arg: Type: address, Value: "0x3d78abc33ccd173c521b4f9e78b21ea2c989960b631732c539efaa38bda30976" │ │
│ │ 1   Pure Arg: Type: u64, Value: "500000000"                                                              │ │
│ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────╯ │
│ ╭──────────────────────╮                                                                                     │
│ │ Commands             │                                                                                     │
│ ├──────────────────────┤                                                                                     │
│ │ 0  SplitCoins:       │                                                                                     │
│ │  ┌                   │                                                                                     │
│ │  │ Coin: GasCoin     │                                                                                     │
│ │  │ Amounts:          │                                                                                     │
│ │  │   Input  1        │                                                                                     │
│ │  └                   │                                                                                     │
│ │                      │                                                                                     │
│ │ 1  TransferObjects:  │                                                                                     │
│ │  ┌                   │                                                                                     │
│ │  │ Arguments:        │                                                                                     │
│ │  │   Result 0        │                                                                                     │
│ │  │ Address: Input  0 │                                                                                     │
│ │  └                   │                                                                                     │
│ ╰──────────────────────╯                                                                                     │
│                                                                                                              │
│ Signatures:                                                                                                  │
│    eZc/iFO3i4Y8Le92zu9q75jILs+yg0sSXd1yPV9Dta+knH99VfkSCnzNQG1KbXSvY24wexmVtiuU6NkfudbiAQ==                  │
│                                                                                                              │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
╭───────────────────────────────────────────────────────────────────────────────────────────────────╮
│ Transaction Effects                                                                               │
├───────────────────────────────────────────────────────────────────────────────────────────────────┤
│ Digest: AsWkciVhLHeCmqVipjjyAA7Hv5y87pFjHS59K8m4zBJV                                              │
│ Status: Success                                                                                   │
│ Executed Epoch: 0                                                                                 │
│                                                                                                   │
│ Created Objects:                                                                                  │
│  ┌──                                                                                              │
│  │ ID: 0xa031d3f8fd53b5f9885172e1c6bd8b770b25e42371c9ee215c6d4b21b2b73241                         │
│  │ Owner: Account Address ( 0x3d78abc33ccd173c521b4f9e78b21ea2c989960b631732c539efaa38bda30976 )  │
│  │ Version: 3                                                                                     │
│  │ Digest: Fq3maqq3pShgKw58Ssm8cS2j1pspfhanedVK2MMxfQWQ                                           │
│  └──                                                                                              │
│ Mutated Objects:                                                                                  │
│  ┌──                                                                                              │
│  │ ID: 0xc9b447fff18f13fa035e028534b8344d5fc8a8760248fad10155e78f44dc3a52                         │
│  │ Owner: Account Address ( 0x0fe375fff0ee40d20c54a7f2478b9b5c7eaa3625b7611f9661ec5faefb4a6fea )  │
│  │ Version: 3                                                                                     │
│  │ Digest: GFB9mpxTP4z6CCShTbvD58FYxtu9G4mnxN3JtFeRupM3                                           │
│  └──                                                                                              │
│ Gas Object:                                                                                       │
│  ┌──                                                                                              │
│  │ ID: 0xc9b447fff18f13fa035e028534b8344d5fc8a8760248fad10155e78f44dc3a52                         │
│  │ Owner: Account Address ( 0x0fe375fff0ee40d20c54a7f2478b9b5c7eaa3625b7611f9661ec5faefb4a6fea )  │
│  │ Version: 3                                                                                     │
│  │ Digest: GFB9mpxTP4z6CCShTbvD58FYxtu9G4mnxN3JtFeRupM3                                           │
│  └──                                                                                              │
│ Gas Cost Summary:                                                                                 │
│    Storage Cost: 1976000 MIST                                                                     │
│    Computation Cost: 1000000 MIST                                                                 │
│    Storage Rebate: 978120 MIST                                                                    │
│    Non-refundable Storage Fee: 9880 MIST                                                          │
│                                                                                                   │
│ Transaction Dependencies:                                                                         │
│    GThyjtRFysBgVppXDc9iduNPzB2bLteXBnJcBEYXz4vG                                                   │
╰───────────────────────────────────────────────────────────────────────────────────────────────────╯
╭─────────────────────────────╮
│ No transaction block events │
╰─────────────────────────────╯

╭──────────────────────────────────────────────────────────────────────────────────────────────────╮
│ Object Changes                                                                                   │
├──────────────────────────────────────────────────────────────────────────────────────────────────┤
│ Created Objects:                                                                                 │
│  ┌──                                                                                             │
│  │ ObjectID: 0xa031d3f8fd53b5f9885172e1c6bd8b770b25e42371c9ee215c6d4b21b2b73241                  │
│  │ Sender: 0x0fe375fff0ee40d20c54a7f2478b9b5c7eaa3625b7611f9661ec5faefb4a6fea                    │
│  │ Owner: Account Address ( 0x3d78abc33ccd173c521b4f9e78b21ea2c989960b631732c539efaa38bda30976 ) │
│  │ ObjectType: 0x2::coin::Coin<0x2::sui::SUI>                                                    │
│  │ Version: 3                                                                                    │
│  │ Digest: Fq3maqq3pShgKw58Ssm8cS2j1pspfhanedVK2MMxfQWQ                                          │
│  └──                                                                                             │
│ Mutated Objects:                                                                                 │
│  ┌──                                                                                             │
│  │ ObjectID: 0xc9b447fff18f13fa035e028534b8344d5fc8a8760248fad10155e78f44dc3a52                  │
│  │ Sender: 0x0fe375fff0ee40d20c54a7f2478b9b5c7eaa3625b7611f9661ec5faefb4a6fea                    │
│  │ Owner: Account Address ( 0x0fe375fff0ee40d20c54a7f2478b9b5c7eaa3625b7611f9661ec5faefb4a6fea ) │
│  │ ObjectType: 0x2::coin::Coin<0x2::sui::SUI>                                                    │
│  │ Version: 3                                                                                    │
│  │ Digest: GFB9mpxTP4z6CCShTbvD58FYxtu9G4mnxN3JtFeRupM3                                          │
│  └──                                                                                             │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
╭───────────────────────────────────────────────────────────────────────────────────────────────────╮
│ Balance Changes                                                                                   │
├───────────────────────────────────────────────────────────────────────────────────────────────────┤
│  ┌──                                                                                              │
│  │ Owner: Account Address ( 0x0fe375fff0ee40d20c54a7f2478b9b5c7eaa3625b7611f9661ec5faefb4a6fea )  │
│  │ CoinType: 0x2::sui::SUI                                                                        │
│  │ Amount: -501997880                                                                             │
│  └──                                                                                              │
│  ┌──                                                                                              │
│  │ Owner: Account Address ( 0x3d78abc33ccd173c521b4f9e78b21ea2c989960b631732c539efaa38bda30976 )  │
│  │ CoinType: 0x2::sui::SUI                                                                        │
│  │ Amount: 500000000                                                                              │
│  └──                                                                                              │
╰───────────────────────────────────────────────────────────────────────────────────────────────────╯

```

Check the gas for the sender and the recipient's coins using `sui client gas <address>`. The sender now has 199.49 SUI for that gas coin that was used. 0.5 SUI was transferred, and the remaining 0.01 SUI paid the gas fees.
```sh
$ sui client gas
```
```sh
╭────────────────────────────────────────────────────────────────────┬────────────────────┬──────────────────╮
│ gasCoinId                                                          │ mistBalance (MIST) │ suiBalance (SUI) │
├────────────────────────────────────────────────────────────────────┼────────────────────┼──────────────────┤
│ 0x205972830acd8264a38b9a1776a1b72a1ae626fa23a4d1f12249349ce3b83c06 │ 200000000000       │ 200.00           │
│ 0x56d76420a5bc7d356e3930e6a2ddc61cbbc0c87ea5c5f3cc3ac5952b4d52be5a │ 200000000000       │ 200.00           │
│ 0xc9b447fff18f13fa035e028534b8344d5fc8a8760248fad10155e78f44dc3a52 │ 199498002120       │ 199.49           │
│ 0xe373de9bdbd3dbd4f5f707f144c83af74a181cdb3903a953ee366f48e33865c7 │ 200000000000       │ 200.00           │
│ 0xf7adb6aeb18eb409c03fe88cc31711b61a65333e0fdd88c1815d4ec75f713f31 │ 200000000000       │ 200.00           │
╰────────────────────────────────────────────────────────────────────┴────────────────────┴──────────────────╯
```
```sh
$ sui client gas eloquent-amber
```
```sh
╭────────────────────────────────────────────────────────────────────┬────────────────────┬──────────────────╮
│ gasCoinId                                                          │ mistBalance (MIST) │ suiBalance (SUI) │
├────────────────────────────────────────────────────────────────────┼────────────────────┼──────────────────┤
│ 0xa031d3f8fd53b5f9885172e1c6bd8b770b25e42371c9ee215c6d4b21b2b73241 │ 500000000          │ 0.50             │
╰────────────────────────────────────────────────────────────────────┴────────────────────┴──────────────────╯
```

If you want to transfer the whole object, you can use `sui client pay-all-sui` or `sui client transfer-sui` (without passing the amount):
```sh
$ sui client pay-sui --recipient eloquent-amber --input-coins 0xc9b447fff18f13fa035e028534b8344d5fc8a8760248fad10155e78f44dc3a52 --gas-budget 5000000
```
or
```sh
$ sui client transfer-sui --to eloquent-amber --sui-coin-object-id 0xc9b447fff18f13fa035e028534b8344d5fc8a8760248fad10155e78f44dc3a52 --gas-budget 5000000
```

Then check the gas for `eloquent-amber` again:
```sh
$ sui client gas eloquent-amber
```
```sh
╭────────────────────────────────────────────────────────────────────┬────────────────────┬──────────────────╮
│ gasCoinId                                                          │ mistBalance (MIST) │ suiBalance (SUI) │
├────────────────────────────────────────────────────────────────────┼────────────────────┼──────────────────┤
│ 0xa031d3f8fd53b5f9885172e1c6bd8b770b25e42371c9ee215c6d4b21b2b73241 │ 500000000          │ 0.50             │
│ 0xc9b447fff18f13fa035e028534b8344d5fc8a8760248fad10155e78f44dc3a52 │ 199496992240       │ 199.49           │
╰────────────────────────────────────────────────────────────────────┴────────────────────┴──────────────────╯
```


### Replay a transaction

Client commands to replay transactions have been deprecated in favor of the `sui replay` command. Learn about replaying a transaction and how it can be used for debugging or profiling in the [Transaction Replay](./replay.mdx), [Debugging Transactions](../ide/debugger.mdx), and [Transaction Trace Analysis](./trace-analysis.mdx) guides.

## Publish a Move package

One of the main uses of the `sui client` command is to publish smart contracts on the Sui network. This example switches the current environment to Devnet, then builds, tests, and publishes one of the existing Move examples available in the Sui repository: [sui/examples/move](https://github.com/MystenLabs/sui/tree/main/examples/move)

This example also makes use of `sui move` commands. To learn more about those commands, see [Sui Move CLI](./move.mdx).

1. Open a terminal or console to the root of your local Sui repository and navigate to the `move_tutorial` example.
    ```sh
    $ cd examples/move/first_package
    ```
1. Switch to Devnet network. This command uses an alias, so the `devnet` value might be different for you, depending on the alias name set in your configuration (use `sui client envs` for a list of your defined networks and their aliases).
    ```sh
    $ sui client switch --env devnet
    ```
1. Use `sui move build` to build the package. You must run this command at the same level as the package manifest file ([Move.toml](https://move-book.com/concepts/manifest.html)).
    ```sh
    $ sui move build
    ```
    The console responds with the status of the build.
    ```sh
    INCLUDING DEPENDENCY Sui
    INCLUDING DEPENDENCY MoveStdlib
    BUILDING first_package
    ```
1. Use `sui move test` to run the unit tests.
    ```sh
    $ sui move test
    ```
    The console responds with updates of its progress.
    ```sh
    INCLUDING DEPENDENCY Sui
    INCLUDING DEPENDENCY MoveStdlib
    BUILDING first_package
    Running Move unit tests
    [ PASS    ] 0x0::example::test_module_init
    [ PASS    ] 0x0::example::test_sword_transactions
    Test result: OK. Total tests: 2; passed: 2; failed: 0
     ```
1. Use the `sui client verify-bytecode-meter` to check if the module passes the bytecode meter.
    ```sh
    $ sui client verify-bytecode-meter
    ```
    The console responds with the maximum allowed values, as well as the amount the package uses.
    ```sh
    Running bytecode verifier for 1 modules
    ╭──────────────────────────────────╮
    │ Module passes metering check. │
    ├────────┬────────────┬────────────┤
    │        │ Module     │ Function   │
    │ Max    │ 16000000   │ 16000000   │
    │ Used   │ 4565       │ 4565       │
    ╰────────┴────────────┴────────────╯
    ```
1. Use `sui client gas` to verify that the active address has a gas coin for paying gas.
    ```sh
    $ sui client gas
    ```
    In the case of this example, the console responds with the information that the address is coinless.
    ```sh
    No gas coins are owned by this address
    ```
1. If you need coins, use `sui client faucet` (not available for Mainnet). For more information on getting gas tokens, see [Get Sui Tokens](/guides/developer/getting-started/get-coins.mdx).
    ```sh
    $ sui client faucet
    ```
1. Use `sui client gas` to verify the current active address received the coins.
    ```sh
    $ sui client gas
    ```
    ```sh
    ╭────────────────────────────────────────────────────────────────────┬─────────────╮
    │ gasCoinId                                                          │ gasBalance  │
    ├────────────────────────────────────────────────────────────────────┼─────────────┤
    │ 0x01b2795ba5800c8f7cb7d7c56abe19e24c656ed6764f3ccc5e66da3de52402a8 │ 10000000000 │
    ╰────────────────────────────────────────────────────────────────────┴─────────────╯
    ```
1. Use `sui client publish` to publish the package, being sure to set an appropriate value for the `gas-budget` flag if you're using an older version of Sui. The console responds with the details of the publish. You can use `sui client object <OBJECT-ID>` to check the details of any of the objects from the process.
    ```sh
    $ sui client publish --gas-budget 100000000 .
    ```
    ```sh
     Transaction Digest: ABPd7v8BxLkcyHvX8Jt1SbneQRwzE9WzcEoptT2RDNVF
    ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
    │ Transaction Data                                                                                             │
    ├──────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
    │ Sender: 0x0fe375fff0ee40d20c54a7f2478b9b5c7eaa3625b7611f9661ec5faefb4a6fea                                   │
    │ Gas Owner: 0x0fe375fff0ee40d20c54a7f2478b9b5c7eaa3625b7611f9661ec5faefb4a6fea                                │
    │ Gas Budget: 5000000000 MIST                                                                                  │
    │ Gas Price: 1000 MIST                                                                                         │
    │ Gas Payment:                                                                                                 │
    │  ┌──                                                                                                         │
    │  │ ID: 0x01b2795ba5800c8f7cb7d7c56abe19e24c656ed6764f3ccc5e66da3de52402a8                                    │
    │  │ Version: 2                                                                                                │
    │  │ Digest: GZQwvpxLeTciVboEWeC8EZ2KYYU9o6XoBtW6LrA5Si1h                                                      │
    │  └──                                                                                                         │
    │                                                                                                              │
    │ Transaction Kind: Programmable                                                                               │
    │ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │
    │ │ Input Objects                                                                                            │ │
    │ ├──────────────────────────────────────────────────────────────────────────────────────────────────────────┤ │
    │ │ 0   Pure Arg: Type: address, Value: "0x0fe375fff0ee40d20c54a7f2478b9b5c7eaa3625b7611f9661ec5faefb4a6fea" │ │
    │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────╯ │
    │ ╭─────────────────────────────────────────────────────────────────────────╮                                  │
    │ │ Commands                                                                │                                  │
    │ ├─────────────────────────────────────────────────────────────────────────┤                                  │
    │ │ 0  Publish:                                                             │                                  │
    │ │  ┌                                                                      │                                  │
    │ │  │ Dependencies:                                                        │                                  │
    │ │  │   0x0000000000000000000000000000000000000000000000000000000000000001 │                                  │
    │ │  │   0x0000000000000000000000000000000000000000000000000000000000000002 │                                  │
    │ │  └                                                                      │                                  │
    │ │                                                                         │                                  │
    │ │ 1  TransferObjects:                                                     │                                  │
    │ │  ┌                                                                      │                                  │
    │ │  │ Arguments:                                                           │                                  │
    │ │  │   Result 0                                                           │                                  │
    │ │  │ Address: Input  0                                                    │                                  │
    │ │  └                                                                      │                                  │
    │ ╰─────────────────────────────────────────────────────────────────────────╯                                  │
    │                                                                                                              │
    │ Signatures:                                                                                                  │
    │    x437h/JxDAba2zkx4a2kEfz6iaXQ08T7+inyP5YkbmlSB5K7IYasM6onckjYDB19FNM1ZNqXm1z13VyTmDHXCw==                  │
    │                                                                                                              │
    ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
    ╭───────────────────────────────────────────────────────────────────────────────────────────────────╮
    │ Transaction Effects                                                                               │
    ├───────────────────────────────────────────────────────────────────────────────────────────────────┤
    │ Digest: ABPd7v8BxLkcyHvX8Jt1SbneQRwzE9WzcEoptT2RDNVF                                              │
    │ Status: Success                                                                                   │
    │ Executed Epoch: 0                                                                                 │
    │                                                                                                   │
    │ Created Objects:                                                                                  │
    │  ┌──                                                                                              │
    │  │ ID: 0x569828cc4e134ccccd7408def18b80af1465ac791fd4ef40483f6b16e2f00d95                         │
    │  │ Owner: Account Address ( 0x0fe375fff0ee40d20c54a7f2478b9b5c7eaa3625b7611f9661ec5faefb4a6fea )  │
    │  │ Version: 3                                                                                     │
    │  │ Digest: 4iD7ZhsFS9iFuszqxBSEL6xZdcnWG76WGgU4D5PH1PeL                                           │
    │  └──                                                                                              │
    │  ┌──                                                                                              │
    │  │ ID: 0xde670ae990c8f20fd53e9f597a0da056bdb634175176602658e9da2c2ec9cb93                         │
    │  │ Owner: Account Address ( 0x0fe375fff0ee40d20c54a7f2478b9b5c7eaa3625b7611f9661ec5faefb4a6fea )  │
    │  │ Version: 3                                                                                     │
    │  │ Digest: AV27tn7ePXhdDyDV9TCkSQZA3mkMei9DV63AmB4DEjGN                                           │
    │  └──                                                                                              │
    │  ┌──                                                                                              │
    │  │ ID: 0xe1d9d66b7a19b27ebda338a52593cd10e728f666f34ecd30a7cc2ad3fed186da                         │
    │  │ Owner: Immutable                                                                               │
    │  │ Version: 1                                                                                     │
    │  │ Digest: 4bzxMQgcSZoKzppNiRtQwAWDBvCgjr18gQi2H8Yk1tQZ                                           │
    │  └──                                                                                              │
    │ Mutated Objects:                                                                                  │
    │  ┌──                                                                                              │
    │  │ ID: 0x01b2795ba5800c8f7cb7d7c56abe19e24c656ed6764f3ccc5e66da3de52402a8                         │
    │  │ Owner: Account Address ( 0x0fe375fff0ee40d20c54a7f2478b9b5c7eaa3625b7611f9661ec5faefb4a6fea )  │
    │  │ Version: 3                                                                                     │
    │  │ Digest: 46rvdbXkw5qqsBYbUGChzgFatJAYPmarPmFHgRRJiiU9                                           │
    │  └──                                                                                              │
    │ Gas Object:                                                                                       │
    │  ┌──                                                                                              │
    │  │ ID: 0x01b2795ba5800c8f7cb7d7c56abe19e24c656ed6764f3ccc5e66da3de52402a8                         │
    │  │ Owner: Account Address ( 0x0fe375fff0ee40d20c54a7f2478b9b5c7eaa3625b7611f9661ec5faefb4a6fea )  │
    │  │ Version: 3                                                                                     │
    │  │ Digest: 46rvdbXkw5qqsBYbUGChzgFatJAYPmarPmFHgRRJiiU9                                           │
    │  └──                                                                                              │
    │ Gas Cost Summary:                                                                                 │
    │    Storage Cost: 9978800                                                                          │
    │    Computation Cost: 1000000                                                                      │
    │    Storage Rebate: 978120                                                                         │
    │    Non-refundable Storage Fee: 9880                                                               │
    │                                                                                                   │
    │ Transaction Dependencies:                                                                         │
    │    891Qjq6qDZ6SzAJiAg3CEaHobXrpDL5bAy2o45ZJPTuB                                                   │
    │    ESHcS3y3VCuaCVmWkKDx3EXX3icfPtj4bHhk86gaGWdo                                                   │
    ╰───────────────────────────────────────────────────────────────────────────────────────────────────╯
    ╭─────────────────────────────╮
    │ No transaction block events │
    ╰─────────────────────────────╯
    ╭────────────────────────────────────────────────────────────────────────────────────────────────────╮
    │ Object Changes                                                                                     │
    ├────────────────────────────────────────────────────────────────────────────────────────────────────┤
    │ Created Objects:                                                                                   │
    │  ┌──                                                                                               │
    │  │ ObjectID: 0x569828cc4e134ccccd7408def18b80af1465ac791fd4ef40483f6b16e2f00d95                    │
    │  │ Sender: 0x0fe375fff0ee40d20c54a7f2478b9b5c7eaa3625b7611f9661ec5faefb4a6fea                      │
    │  │ Owner: Account Address ( 0x0fe375fff0ee40d20c54a7f2478b9b5c7eaa3625b7611f9661ec5faefb4a6fea )   │
    │  │ ObjectType: 0xe1d9d66b7a19b27ebda338a52593cd10e728f666f34ecd30a7cc2ad3fed186da::example::Forge  │
    │  │ Version: 3                                                                                      │
    │  │ Digest: 4iD7ZhsFS9iFuszqxBSEL6xZdcnWG76WGgU4D5PH1PeL                                            │
    │  └──                                                                                               │
    │  ┌──                                                                                               │
    │  │ ObjectID: 0xde670ae990c8f20fd53e9f597a0da056bdb634175176602658e9da2c2ec9cb93                    │
    │  │ Sender: 0x0fe375fff0ee40d20c54a7f2478b9b5c7eaa3625b7611f9661ec5faefb4a6fea                      │
    │  │ Owner: Account Address ( 0x0fe375fff0ee40d20c54a7f2478b9b5c7eaa3625b7611f9661ec5faefb4a6fea )   │
    │  │ ObjectType: 0x2::package::UpgradeCap                                                            │
    │  │ Version: 3                                                                                      │
    │  │ Digest: AV27tn7ePXhdDyDV9TCkSQZA3mkMei9DV63AmB4DEjGN                                            │
    │  └──                                                                                               │
    │ Mutated Objects:                                                                                   │
    │  ┌──                                                                                               │
    │  │ ObjectID: 0x01b2795ba5800c8f7cb7d7c56abe19e24c656ed6764f3ccc5e66da3de52402a8                    │
    │  │ Sender: 0x0fe375fff0ee40d20c54a7f2478b9b5c7eaa3625b7611f9661ec5faefb4a6fea                      │
    │  │ Owner: Account Address ( 0x0fe375fff0ee40d20c54a7f2478b9b5c7eaa3625b7611f9661ec5faefb4a6fea )   │
    │  │ ObjectType: 0x2::coin::Coin<0x2::sui::SUI>                                                      │
    │  │ Version: 3                                                                                      │
    │  │ Digest: 46rvdbXkw5qqsBYbUGChzgFatJAYPmarPmFHgRRJiiU9                                            │
    │  └──                                                                                               │
    │ Published Objects:                                                                                 │
    │  ┌──                                                                                               │
    │  │ PackageID: 0xe1d9d66b7a19b27ebda338a52593cd10e728f666f34ecd30a7cc2ad3fed186da                   │
    │  │ Version: 1                                                                                      │
    │  │ Digest: 4bzxMQgcSZoKzppNiRtQwAWDBvCgjr18gQi2H8Yk1tQZ                                            │
    │  │ Modules: example                                                                                │
    │  └──                                                                                               │
    ╰────────────────────────────────────────────────────────────────────────────────────────────────────╯
    ╭───────────────────────────────────────────────────────────────────────────────────────────────────╮
    │ Balance Changes                                                                                   │
    ├───────────────────────────────────────────────────────────────────────────────────────────────────┤
    │  ┌──                                                                                              │
    │  │ Owner: Account Address ( 0x0fe375fff0ee40d20c54a7f2478b9b5c7eaa3625b7611f9661ec5faefb4a6fea )  │
    │  │ CoinType: 0x2::sui::SUI                                                                        │
    │  │ Amount: -10000680                                                                              │
    │  └──                                                                                              │
    ╰───────────────────────────────────────────────────────────────────────────────────────────────────╯
    ```

## Help

Each command has its own help section. For example:

```sh
$ sui client call --help
```

<ImportContent source="console-output/sui-client-call-help.mdx" mode="snippet" />
